package com.test.springboot.springboot3testdemo3.convertor;

import com.test.springboot.springboot3testdemo3.dto.UserDTO;
import com.test.springboot.springboot3testdemo3.entity.UserEntity;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * Created with IntelliJ IDEA.
 *
 * @author： liuziyang
 * @date： 2024/9/14-14:42
 * @description：
 * @modifiedBy：
 * @version: 1.0
 */
@Mapper
public interface UserMapper {
  UserMapper INSTANCE = Mappers.getMapper(UserMapper.class);

  /**
   * Convert to dto user dto.
   *
   * @param userEntity the user entity
   * @return the user dto
   */
  @Mapping(source = "id", target = "userId")
  @Mapping(source = "username", target = "userFullName")
  @Mapping(source = "email", target = "contactEmail")
  @Mapping(source = "active", target = "status")
  UserDTO convertToDTO(UserEntity userEntity);
}
